package cn.lili.controller.feign;

import cn.lili.modules.promotion.client.RedPackGoodsClient;
import cn.lili.modules.promotion.entity.dos.RedPackGoods;
import cn.lili.modules.promotion.entity.dto.search.RedPackGoodsSearchParams;
import cn.lili.modules.promotion.entity.vos.RedPackGoodsVO;
import cn.lili.modules.promotion.service.RedPackGoodsService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: ftyy
 * @date: 2022-01-13 19:31
 * @description: 积分商品实现类
 */
@RestController
@RequiredArgsConstructor
public class RedPackGoodsFeignController implements RedPackGoodsClient {

    private final RedPackGoodsService redPackGoodsService;

    @Override
    public boolean saveRedPackGoodsBatch(List<RedPackGoods> promotionsList) {
        return redPackGoodsService.saveRedPackGoodsBatch(promotionsList);
    }

    @Override
    public RedPackGoodsVO getRedPackGoodsDetail(String id) {
        return redPackGoodsService.getRedPackGoodsDetail(id);
    }

    @Override
    public RedPackGoodsVO getRedPackGoodsDetailBySkuId(String skuId) {
        return redPackGoodsService.getRedPackGoodsDetailBySkuId(skuId);
    }

    @Override
    public void updateById(RedPackGoodsVO redPackGoodsVO) {
      redPackGoodsService.updateById(redPackGoodsVO);
    }

    @Override
    public Boolean deleteRedPackGoods(RedPackGoodsSearchParams redPackGoodsSearchParams) {
        return redPackGoodsService.remove(redPackGoodsSearchParams.queryWrapper());
    }
}
